package com.example.mybatisplusproject;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

import java.util.concurrent.locks.LockSupport;

public class LockSupportTest  implements BeanFactoryPostProcessor {
    public static void main(String[] args) throws InterruptedException {
//        SqlSession sqlSession = new SqlSessionFactoryBuilder().build().openSession();
//        Object mapper = sqlSession.getMapper();
        Thread thread = new Thread (() -> {
            System.out.println ("即将中断中断");
            LockSupport.park ();
            System.err.println(Thread.currentThread().isInterrupted());
            System.out.println ("第一次被唤醒");
            System.err.println(Thread.currentThread().isInterrupted());
            Thread.interrupted ();
//            Thread.currentThread ().isInterrupted ();
            LockSupport.park ();
            System.out.println ("第二次被唤醒");
        });
        thread.start ();
        Thread.sleep (1000);
//        LockSupport.unpark (thread);
        thread.interrupt();
        System.out.println ("主线程");
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition aaa = beanFactory.getBeanDefinition("aaa");

    }
}